﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="采购原料合同管理.aspx.cs" Inherits="syc.Sale.采购原料合同管理" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<link rel="stylesheet" href="jquery.checkbox.css" />
<link rel="stylesheet" href="jquery.safari-checkbox.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.checkbox.min.js"></script>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('input:checkbox:not([safari])').checkbox();
        $('input[safari]:checkbox').checkbox({ cls: 'jquery-safari-checkbox' });
        $('input:radio').checkbox();
    });
						
</script>
<form id="form1" runat="server">
<asp:Label ID="BID" runat="server" Text="0" Visible="false"></asp:Label>
<asp:Label ID="SelectedID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="SelectedID0" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
onselected="SqlDataSource1_Selected" 
UpdateCommand="UPDATE [采购原料合同]
SET [是否完成] = @是否完成
WHERE [采购原料合同].[ID]=@ID" >
                   <UpdateParameters>
                        <asp:Parameter Name="是否完成" Type="Boolean" />
                        <asp:Parameter Name="ID" Type="Int32" />
                    </UpdateParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="select 0 as ID,'全部' as 名称 union SELECT [ID], [名称] FROM [原料供货单位]"></asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="select ID=0,品名='全部' union SELECT [ID], [品名]+'('+[钢级]+')'+' '+规格 as 品名 FROM [原料]"></asp:SqlDataSource>

<div id="wintop" class="wintop">原料采购合同管理</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <asp:Button ID="Button_View" runat="server" Text="查 看" CssClass="button" UseSubmitBehavior="False"/>
    <asp:Button ID="Button_Edit" runat="server" Text="修 改" CssClass="button" 
        UseSubmitBehavior="False"  />
    <asp:Button ID="Button_In" runat="server" Text="执行情况" CssClass="button" UseSubmitBehavior="False"/>
    <asp:Button ID="Button_Delete" runat="server" Text="删 除" CssClass="button"   Visible="false"
        UseSubmitBehavior="False" 
        OnClientClick="if(!confirm('确认要删除该条记录吗？'))return(false);" 
        onclick="Button_Delete_Click" />
</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="原料采购合同查询">
合同编号：<asp:TextBox ID="BianHao" runat="server" Width="140" CssClass="textbox"></asp:TextBox>
<span style="display:inline-block;width:80px;text-align:right;">合同年度：</span><asp:DropDownList
    ID="NianDu" runat="server" Width="120">
    <asp:ListItem Value="0">全部</asp:ListItem>
    <asp:ListItem Value="2008">2008</asp:ListItem>
    <asp:ListItem Value="2009">2009</asp:ListItem>
    <asp:ListItem Value="2010">2010</asp:ListItem>
    <asp:ListItem Value="2011">2011</asp:ListItem>
    <asp:ListItem Value="2012">2012</asp:ListItem>
    <asp:ListItem Value="2013">2013</asp:ListItem>
    <asp:ListItem Value="2014">2014</asp:ListItem>
    <asp:ListItem Value="2015">2015</asp:ListItem>
    <asp:ListItem Value="2016">2016</asp:ListItem>
    <asp:ListItem Value="2017">2017</asp:ListItem>
    <asp:ListItem Value="2018">2018</asp:ListItem>
    <asp:ListItem Value="2019">2019</asp:ListItem>
    <asp:ListItem Value="2020">2020</asp:ListItem>
    </asp:DropDownList>
    
<span style="display:inline-block;width:60px;text-align:right;">季度：</span><asp:DropDownList
    ID="JiDu" runat="server" Width="80">
    <asp:ListItem Value="0">全部</asp:ListItem>
    <asp:ListItem Value="1">1 季度</asp:ListItem>
    <asp:ListItem Value="2">2 季度</asp:ListItem>
    <asp:ListItem Value="3">3 季度</asp:ListItem>
    <asp:ListItem Value="4">4 季度</asp:ListItem>
    </asp:DropDownList>
<br />
原料类别：<asp:DropDownList ID="LeiBie" runat="server" Width="220px" Font-Size="12px"
        DataSourceID="SqlDataSource3" DataTextField="品名" DataValueField="ID">

</asp:DropDownList>
<span style="display:inline-block;width:80px;text-align:right;">供货单位：</span><asp:DropDownList ID="GongHuo" runat="server" Width="120" 
        DataSourceID="SqlDataSource2" DataTextField="名称" DataValueField="ID"></asp:DropDownList>
<span style="display:inline-block;width:20px;text-align:right;"></span>
<asp:Button ID="Button_Query" runat="server" Text="查 询" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Query_Click" />
        
<asp:Button ID="Button_Reset" runat="server" Text="清空条件" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Reset_Click" />
</asp:Panel>


<div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title">原料采购合同</td>
	        </tr>
	        <tr>
	            <td class="grid-back">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID,合同编号" 
                        DataSourceID="SqlDataSource1"
                        PageSize="15"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        UseAccessibleHeader="False" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged">
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                        
                            <asp:TemplateField HeaderText="">
                                <ItemTemplate>
                                    <asp:Button ID="Button_xz" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                    <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                            </asp:TemplateField>
                           
                            <asp:TemplateField HeaderText="zid"   Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zid" runat="server" Text='<%# Eval("zid") %>'></asp:Label>                                    
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="70px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="bid" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="Label_bid" runat="server" Text='<%# Eval("bid") %>'></asp:Label>                                    
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="70px" />
                            </asp:TemplateField>
                            
                            
                            
                            <asp:TemplateField HeaderText="合同编号">
                                <ItemTemplate>
                                    <asp:Label ID="Label_ht" runat="server" Text='<%# Eval("合同编号") %>'></asp:Label>
                                    <input type="button" class="mbutton" value="录入合同" style='display:<%# ((int)Eval("合同ID")==0) ? "":"none" %>' onclick='hetong(<%# Eval("zid") %>)' />
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="70px" />
                            </asp:TemplateField>

                            
                            <asp:TemplateField HeaderText="年度" SortExpression="年度">
                                <ItemTemplate>
                                    <asp:Label ID="Label_nd" runat="server" Text='<%# Eval("年度") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="50px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="季度" SortExpression="季度">
                                <ItemTemplate>
                                    <asp:Label ID="Label_jd" runat="server" Text='<%# Eval("季度") %>'></asp:Label> 季度
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="50px" />
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="供货单位" SortExpression="中标单位">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gh" runat="server" Text='<%# Eval("中标单位") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="原料类别" SortExpression="品名">
                                <ItemTemplate>
                                    <asp:Label ID="Label_lb" runat="server" Text='<%# Eval("品名") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="110px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="钢级">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gj" runat="server" Text='<%# Eval("钢级") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="50px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="规格">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gg" runat="server" Text='<%# Eval("规格") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px" />
                            </asp:TemplateField>                          
                            <asp:TemplateField HeaderText="单位">
                                <ItemTemplate>
                                    <asp:Label ID="Label_dw" runat="server" Text='<%# Eval("单位") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px" />
                            </asp:TemplateField>    
                            <asp:TemplateField HeaderText="数量" SortExpression="数量">
                                <ItemTemplate>
                                    <asp:Label ID="Label_sl" runat="server" Text='<%# Eval("数量") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="right" Width="70px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="单价(元)" SortExpression="单价">
                                <ItemTemplate>
                                    <asp:Label ID="Label_dj" runat="server" Text='<%# Eval("单价") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="right" Width="70px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="录入日期" SortExpression="签订日期">
                                <ItemTemplate>
                                    <asp:Label ID="Label_rq" runat="server" Text='<%# Eval("签订日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="70px" />
                            </asp:TemplateField>                         
                             
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>

</form>
<script>
    var msg = '确认要删除该条记录吗？';
    function hetong(zid) {
        parent.swin2_load("/Sale/采购原料合同录入.aspx?zid=" + zid + "&bid=<%=this.BID.Text %>", 720, 440);
    }
  
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    setTimeout("document.getElementById('ShuLiang').focus();", 100);    
   
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = selectRow;
        }
        else if (rows[i].className == "grid-row-selected") {
            //rows[i].onclick = function() { parent.swin2_load('//.aspx?id=<%=this.SelectedID.Text %>', 820, 296); }; 
        }
    }


    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName != "INPUT" || tag.className != "textbox") return;
        if (tag.id == "BeiZhu") return;
        if (e.keyCode == 13) e.keyCode = 9;
    }  
    parent.hidesubmenu(true);
</script>
</body>
</html>
